net: hns3: synchronize speed and duplex from phy when phy link up
authorPeng Li <lipeng321@huawei.com>
Tue, 18 Dec 2018 11:37:56 +0000 (19:37 +0800)
committerSalvatore Bonaccorso <carnil@debian.org>
Thu, 18 Jul 2019 22:23:17 +0000 (23:23 +0100)
Driver calls phy_connect_direct and registers hclge_mac_adjust_link
to synchronize mac speed and duplex from phy. It is better to
synchronize mac speed and duplex from phy when phy link up.

Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Gbp-Pq: Topic bugfix/arm64/huawei-taishan
Gbp-Pq: Name 0019-net-hns3-synchronize-speed-and-duplex-from-phy-when-.patch

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c

index a75b70ce41f845b6b542d135743b6486513a8cf5..bdbec85265f479b0970535e9046ebbdcc41b97d6 100644 (file)
@@ -181,6 +181,10 @@ static void hclge_mac_adjust_link(struct net_device *netdev)
        int duplex, speed;
        int ret;
 
+       /* When phy link down, do nothing */
+       if (netdev->phydev->link == 0)
+               return;
+
        speed = netdev->phydev->speed;
        duplex = netdev->phydev->duplex;